import {
  Controller,
  Get,
  Post,
  Body,
  Put,
  Request,
  Param,
  Delete,
  UseGuards,
} from '@nestjs/common';
import { MailAccountService } from './mail-account.service';
import { Account } from '../entities/account.entity';
import { AuthGuard } from '@nestjs/passport';
@Controller('mail-account')
export class MailAccountController {
  constructor(private readonly mailAccountService: MailAccountService) {}
  @Post()
  @UseGuards(AuthGuard('jwt'))
  create(@Body() account: Account, @Request() req) {
    return this.mailAccountService.create(account, req);
  }
  @Get()
  @UseGuards(AuthGuard('jwt'))
  findAll() {
    return this.mailAccountService.findAll();
  }
  @Get(':id')
  @UseGuards(AuthGuard('jwt'))
  findOne(@Param('id') id: string) {
    return this.mailAccountService.findOne(id);
  }
  @Put(':id')
  @UseGuards(AuthGuard('jwt'))
  update(@Param('id') id: string, @Body() account: Account) {
    return this.mailAccountService.update(id, account);
  }
  @Delete(':id')
  @UseGuards(AuthGuard('jwt'))
  remove(@Param('id') id: string) {
    return this.mailAccountService.remove(id);
  }
}
